<?php

/**
 * MasterDirectory form base class.
 *
 * @method MasterDirectory getObject() Returns the current form's model object
 *
 * @package    campaign_generation
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseMasterDirectoryForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                       => new sfWidgetFormInputHidden(),
      'name'                     => new sfWidgetFormInputText(),
      'domain'                   => new sfWidgetFormInputText(),
      'deleted'                  => new sfWidgetFormInputText(),
      'directory_type_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('DirectoryType'), 'add_empty' => false)),
      'parent_id'                => new sfWidgetFormInputText(),
      'home_template_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Template'), 'add_empty' => true)),
      'analytics_script'         => new sfWidgetFormTextarea(),
      'search_title'             => new sfWidgetFormInputText(),
      'user_id'                  => new sfWidgetFormInputText(),
      'language_id'              => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Language'), 'add_empty' => false)),
      'theme_color'              => new sfWidgetFormInputText(),
      'search_button_caption'    => new sfWidgetFormInputText(),
      'fb_app'                   => new sfWidgetFormInputText(),
      'search_in_sitemap'        => new sfWidgetFormInputText(),
      'analytics_metatag'        => new sfWidgetFormTextarea(),
      'price_formula_a'          => new sfWidgetFormInputText(),
      'price_formula_b'          => new sfWidgetFormInputText(),
      'currency_symbol'          => new sfWidgetFormInputText(),
      'google_site_verification' => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'name'                     => new sfValidatorString(array('max_length' => 255)),
      'domain'                   => new sfValidatorString(array('max_length' => 255)),
      'deleted'                  => new sfValidatorInteger(array('required' => false)),
      'directory_type_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('DirectoryType'))),
      'parent_id'                => new sfValidatorInteger(array('required' => false)),
      'home_template_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Template'), 'required' => false)),
      'analytics_script'         => new sfValidatorString(),
      'search_title'             => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'user_id'                  => new sfValidatorInteger(array('required' => false)),
      'language_id'              => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Language'))),
      'theme_color'              => new sfValidatorString(array('max_length' => 7, 'required' => false)),
      'search_button_caption'    => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'fb_app'                   => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'search_in_sitemap'        => new sfValidatorInteger(array('required' => false)),
      'analytics_metatag'        => new sfValidatorString(array('required' => false)),
      'price_formula_a'          => new sfValidatorNumber(array('required' => false)),
      'price_formula_b'          => new sfValidatorNumber(array('required' => false)),
      'currency_symbol'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'google_site_verification' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('master_directory[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'MasterDirectory';
  }

}
